/**************************************************************

Copyright Astrium Services GEO-Information / Spot Image
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

 ***************************************************************/
package com.spotimage.catalog.client.ui.listgrid;

import java.util.Date;

import com.smartgwt.client.widgets.grid.ListGridRecord;
import com.spotimage.catalog.client.json.JSONPoint;
import com.spotimage.catalog.client.shared.Scene;
import com.spotimage.catalog.client.util.SceneTypes;
import com.spotimage.catalog.client.util.Util;

/**
 * ListGridRecord of scene for SceneListGrid
 */
public class SceneListGridRecord extends ListGridRecord implements Scene {

	/**
	 * @param id
	 * @param cloudCoverPercentage
	 * @param acquisitionDate
	 * @param imageUrl
	 * @param satellite
	 * @param archivingStation TODO
	 * @param upperRight 
	 * @param lowerLeft 
	 * @param lowerRight 
	 */
	public SceneListGridRecord(String id, String cloudCoverPercentage, Date acquisitionDate, String imageUrl, String satellite,
			String snowCoverPercentage, String metadataUrl, String shift, String minShift, String maxShift, String archivingStation,
			JSONPoint upperLeft, JSONPoint upperRight, JSONPoint lowerLeft, JSONPoint lowerRight) {
		setId(id);
		setCloudCoverPercentage(cloudCoverPercentage);
		setAcquisitionDate(acquisitionDate);
		setImageUrl(imageUrl);
		setSatellite(satellite);
		setType(SceneTypes.get(id));
		setSnowCoverPercentage(snowCoverPercentage);
		setMetadataUrl(metadataUrl);
		setShift(shift);
		setMinShift(minShift);
		setMaxShift(maxShift);
		setArchivingStation(archivingStation);
		setUpperLeft(upperLeft);
		setUpperRight(upperRight);
		setLowerLeft(lowerLeft);
		setLowerRight(lowerRight);
	}

	public String getId() {
		return getAttributeAsString("id");
	}

	public void setId(String id) {
		setAttribute("id", id);
	}
	
	public String getCloudCoverPercentage() {
		return getAttributeAsString("cloudCoverPercentage");
	}

	public void setCloudCoverPercentage(String cloudCoverPercentage) {
		setAttribute("cloudCoverPercentage", cloudCoverPercentage);
	}

	public Date getAcquisitionDate() {
		return getAttributeAsDate("acquisitionDate");
	}
	
	public String getAcquisitionDateString() {
		return Util.getDateString(getAttributeAsDate("acquisitionDate"));
	}

	public void setAcquisitionDate(Date acquisitionDate) {
		setAttribute("acquisitionDate", acquisitionDate);
	}
	
	public String getImageUrl() {
		return getAttributeAsString("imageUrl");
	}

	public void setImageUrl(String imageUrl) {
		setAttribute("imageUrl", imageUrl);
	}

	public String getSatellite() {
		return getAttributeAsString("satellite");
	}

	public void setSatellite(String satellite) {
		setAttribute("satellite", satellite);
	}
	
	public String getType() {
		return getAttributeAsString("type");
	}

	private void setType(String type) {
		setAttribute("type", type);
	}

	public String getMaxShift() {
		return getAttributeAsString("maxShift");
	}
	
	private void setMaxShift(String maxShift) {
		setAttribute("maxShift", maxShift);
	}

	public String getMetadataUrl() {
		return getAttributeAsString("metadataUrl");
	}

	private void setMetadataUrl(String metadataUrl) {
		setAttribute("metadataUrl", metadataUrl);
	}
	
	public String getMinShift() {
		return getAttributeAsString("minShift");
	}
	
	private void setMinShift(String minShift) {
		setAttribute("minShift", minShift);
	}

	public String getShift() {
		return getAttributeAsString("shift");
	}
	
	private void setShift(String shift) {
		setAttribute("shift", shift);
	}

	public String getSnowCoverPercentage() {
		return getAttributeAsString("snowCoverPercentage");
	}
	
	private void setSnowCoverPercentage(String snowCoverPercentage) {
		setAttribute("snowCoverPercentage", snowCoverPercentage);
	}
	
	public String getArchivingStation() {
		return getAttributeAsString("archivingStation");
	}
	
	private void setArchivingStation(String archivingStation) {
		setAttribute("archivingStation", archivingStation);
	}

	public JSONPoint getUpperLeft() {
		return (JSONPoint) getAttributeAsJavaScriptObject("upperLeft");
	}
	
	private void setUpperLeft(JSONPoint upperLeft) {
		setAttribute("upperLeft", upperLeft);
	}
	
	public JSONPoint getLowerLeft() {
		return (JSONPoint) getAttributeAsJavaScriptObject("lowerLeft");
	}
	
	private void setLowerLeft(JSONPoint lowerLeft) {
		setAttribute("lowerLeft", lowerLeft);
	}

	public JSONPoint getLowerRight() {
		return (JSONPoint) getAttributeAsJavaScriptObject("lowerRight");
	}
	
	private void setLowerRight(JSONPoint lowerRight) {
		setAttribute("lowerRight", lowerRight);
	}

	public JSONPoint getUpperRight() {
		return (JSONPoint) getAttributeAsJavaScriptObject("upperRight");
	}
	
	private void setUpperRight(JSONPoint upperRight) {
		setAttribute("upperRight", upperRight);
	}

}